<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>制作重定向链接</title>
  <script src="https://shc7432.github.io/public/something/sometool.js"></script>
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <script src="https://shc7432.github.io/public/getLinkInput/getLinkInput.js"></script>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://shc0743.github.io/crypto-js/core.js"></script>
<script src="https://shc0743.github.io/crypto-js/enc-base64.js"></script>
<script src="https://shc0743.github.io/crypto-js/enc-hex.js"></script>
<script src="https://shc0743.github.io/crypto-js/enc-utf8.js"></script>
<script src="https://shc0743.github.io/crypto-js/enc-utf16.js"></script>
<script src="https://shc0743.github.io/crypto-js/crypto-js.js"></script>
<script src="https://shc0743.github.io/crypto-js/aes.js"></script>
<script src="https://shc0743.github.io/crypto-js/md5.js"></script>
<script src="https://shc0743.github.io/crypto-js/sha1.js"></script>
<script src="https://shc0743.github.io/crypto-js/sha512.js"></script>
</head>
<body>
<h1>制作重定向链接</h1>
<form id=makelk onsubmit="return false;">
链接:<input id=linki size=40 required type=url><br>
<input type=checkbox id=cjadd>多次重定向<br>
<input type=checkbox id=needpw>需要密码<br>密码:<input id=setpwv type=text maxlength=15 placeholder="最大长度15位"><br>
<button type=submit>制作</button>
</form>
制作结果:<br>
<textarea id=outresult readonly placeholder=制作结果 cols=50 rows=3></textarea>

<script>
window.pwTools=new Object();

pwTools.base64=new Object();
pwTools.base64.add=function(str){
  return btoa(encodeURIComponent(str));
}
pwTools.base64.unadd=function(str){
  return decodeURIComponent(atob(str));
}

makelk.onsubmit=function(){
let a=linki.value;
if(needpw.checked){
let pw=setpwv.value;
pw=pwTools.base64.add(pw);
pw=encodeURIComponent(pw);
a=pwTools.base64.add(a);
}
a=encodeURIComponent(a);
if(cjadd.checked){
a="https://shc7432.github.io/download/returnto/return?link="+a;
} else {
a="https://shc7432.github.io/download/returnto/return?isNotMuch=true&link="+a;
}
if(needpw.checked) a+="&pw="+pw;
outresult.value=a;
return false;
}
$(function(){
$("button").button()
})
</script>
</body>
</html>
